<template>
  <div class="number">
    <van-nav-bar title="手机号登录" left-arrow @click-left="onClickLeft" />
    <div class="input-box">
      <div class="num">
        <p>手机号：+86</p>
        <input type="text" v-model="account" />
      </div>
      <div class="password">
        密码：
        <input type="password" v-model="password" />
      </div>
      <button class="div" @click="study">登录</button>
      <p class="mima">忘记密码?</p>
    </div>
  </div>
</template>

<script>
import { post } from "../../tools/request";
export default {
  data() {
    return {
      show: false,
      value: "",
      account: "",
      password: "",
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    study() {
      console.log(this.value);
      post("/api/l1/User/login", {
        account: this.account,
        password: this.password,
      }).then((res) => {
        console.log(res);
        if (res.tit == "登录成功") {
          localStorage.setItem("account", JSON.stringify(res.data));
          this.$router.push({
            name: "study",
          });
        } else {
          alert(res.tit);
        }
      });
    },
  },
  created() {
    this.$store.commit("tabHide");
  },
};
</script>

<style lang="scss">
.number {
  .van-nav-bar__title {
    font-weight: bold;
    font-size: 16px;
    line-height: 150%;
    text-align: center;
    font-weight: bold;
  }
  .input-box {
    width: 291px;
    height: 252px;
    // border: 1px solid black;
    margin: 70px auto;
    position: relative;
    .div {
      height: 37px;
      width: 100%;
      text-align: center;
      line-height: 37px;
      background-color: rgba(51, 177, 123, 1);
      font-size: 14px;
      color: rgba(255, 255, 255, 1);
      border-radius: 4px;
      position: absolute;
      bottom: 50px;
      border: 0;
    }
    .mima {
      width: 100%;
      height: 30px;
      text-align: center;
      line-height: 30px;
      position: absolute;
      bottom: 0;
      color: rgba(166, 166, 166, 1);
      font-size: 13px;
    }
    .num,
    .password {
      height: 38px;
      border-bottom: 1px solid rgba(236, 238, 241, 1);
      color: rgba(120, 130, 153, 1);
      font-size: 14px;
      line-height: 38px;
      input {
        border: 0;
        line-height: 30px;
      }
    }
    .num {
      display: flex;
      p {
        width: 120px;
      }
    }
  }
}
</style>